<template>
  <a-spin :spinning="confirmLoading">
    <JFormContainer :disabled="disabled">
      <template #detail>
        <a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="SoilRockSlopeSettingForm">
          <a-row>
						<a-col :span="24">
							<a-form-item label="切坡高度权重" v-bind="validateInfos.cutSlopeHeightWeight" id="SoilRockSlopeSettingForm-cutSlopeHeightWeight" name="cutSlopeHeightWeight">
								<a-input-number v-model:value="formData.cutSlopeHeightWeight" placeholder="请输入切坡高度权重" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡高度 H≤5m" v-bind="validateInfos.cutSlopeHeight1" id="SoilRockSlopeSettingForm-cutSlopeHeight1" name="cutSlopeHeight1">
								<a-input-number v-model:value="formData.cutSlopeHeight1" placeholder="请输入切坡高度 H≤5m" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡高度 5m＜H≤10m" v-bind="validateInfos.cutSlopeHeight2" id="SoilRockSlopeSettingForm-cutSlopeHeight2" name="cutSlopeHeight2">
								<a-input-number v-model:value="formData.cutSlopeHeight2" placeholder="请输入切坡高度 5m＜H≤10m" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡高度 10m＜H≤15m" v-bind="validateInfos.cutSlopeHeight3" id="SoilRockSlopeSettingForm-cutSlopeHeight3" name="cutSlopeHeight3">
								<a-input-number v-model:value="formData.cutSlopeHeight3" placeholder="请输入切坡高度 10m＜H≤15m" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡高度 H＞15m" v-bind="validateInfos.cutSlopeHeight4" id="SoilRockSlopeSettingForm-cutSlopeHeight4" name="cutSlopeHeight4">
								<a-input-number v-model:value="formData.cutSlopeHeight4" placeholder="请输入切坡高度 H＞15m" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡坡度权重" v-bind="validateInfos.cutSlopeGradientWeight" id="SoilRockSlopeSettingForm-cutSlopeGradientWeight" name="cutSlopeGradientWeight">
								<a-input-number v-model:value="formData.cutSlopeGradientWeight" placeholder="请输入切坡坡度权重" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡坡度 a≤45°" v-bind="validateInfos.cutSlopeGradient1" id="SoilRockSlopeSettingForm-cutSlopeGradient1" name="cutSlopeGradient1">
								<a-input-number v-model:value="formData.cutSlopeGradient1" placeholder="请输入切坡坡度 a≤45°" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡坡度 45°＜a≤60°" v-bind="validateInfos.cutSlopeGradient2" id="SoilRockSlopeSettingForm-cutSlopeGradient2" name="cutSlopeGradient2">
								<a-input-number v-model:value="formData.cutSlopeGradient2" placeholder="请输入切坡坡度 45°＜a≤60°" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡坡度 60°＜a≤75°" v-bind="validateInfos.cutSlopeGradient3" id="SoilRockSlopeSettingForm-cutSlopeGradient3" name="cutSlopeGradient3">
								<a-input-number v-model:value="formData.cutSlopeGradient3" placeholder="请输入切坡坡度 60°＜a≤75°" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡坡度 ＞75°" v-bind="validateInfos.cutSlopeGradient4" id="SoilRockSlopeSettingForm-cutSlopeGradient4" name="cutSlopeGradient4">
								<a-input-number v-model:value="formData.cutSlopeGradient4" placeholder="请输入切坡坡度 ＞75°" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡坡形权重" v-bind="validateInfos.cutSlopeShapeWeight" id="SoilRockSlopeSettingForm-cutSlopeShapeWeight" name="cutSlopeShapeWeight">
								<a-input-number v-model:value="formData.cutSlopeShapeWeight" placeholder="请输入切坡坡形权重" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡坡形 阶梯型" v-bind="validateInfos.cutSlopeShape1" id="SoilRockSlopeSettingForm-cutSlopeShape1" name="cutSlopeShape1">
								<a-input-number v-model:value="formData.cutSlopeShape1" placeholder="请输入切坡坡形 阶梯型" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡坡形 内凹型" v-bind="validateInfos.cutSlopeShape2" id="SoilRockSlopeSettingForm-cutSlopeShape2" name="cutSlopeShape2">
								<a-input-number v-model:value="formData.cutSlopeShape2" placeholder="请输入切坡坡形 内凹型" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡坡形 直线型" v-bind="validateInfos.cutSlopeShape3" id="SoilRockSlopeSettingForm-cutSlopeShape3" name="cutSlopeShape3">
								<a-input-number v-model:value="formData.cutSlopeShape3" placeholder="请输入切坡坡形 直线型" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="切坡坡形 外凸型" v-bind="validateInfos.cutSlopeShape4" id="SoilRockSlopeSettingForm-cutSlopeShape4" name="cutSlopeShape4">
								<a-input-number v-model:value="formData.cutSlopeShape4" placeholder="请输入切坡坡形 外凸型" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="自然斜坡坡度权重" v-bind="validateInfos.naturalSlopeGradientWeight" id="SoilRockSlopeSettingForm-naturalSlopeGradientWeight" name="naturalSlopeGradientWeight">
								<a-input-number v-model:value="formData.naturalSlopeGradientWeight" placeholder="请输入自然斜坡坡度权重" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="自然斜坡坡度 b≤20°" v-bind="validateInfos.naturalSlopeGradient1" id="SoilRockSlopeSettingForm-naturalSlopeGradient1" name="naturalSlopeGradient1">
								<a-input-number v-model:value="formData.naturalSlopeGradient1" placeholder="请输入自然斜坡坡度 b≤20°" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="自然斜坡坡度 20°＜b≤30°" v-bind="validateInfos.naturalSlopeGradient2" id="SoilRockSlopeSettingForm-naturalSlopeGradient2" name="naturalSlopeGradient2">
								<a-input-number v-model:value="formData.naturalSlopeGradient2" placeholder="请输入自然斜坡坡度 20°＜b≤30°" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="自然斜坡坡度 ＞30°" v-bind="validateInfos.naturalSlopeGradient3" id="SoilRockSlopeSettingForm-naturalSlopeGradient3" name="naturalSlopeGradient3">
								<a-input-number v-model:value="formData.naturalSlopeGradient3" placeholder="请输入自然斜坡坡度 ＞30°" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="上覆土层松散程度权重" v-bind="validateInfos.upperSoilLoosenessWeight" id="SoilRockSlopeSettingForm-upperSoilLoosenessWeight" name="upperSoilLoosenessWeight">
								<a-input-number v-model:value="formData.upperSoilLoosenessWeight" placeholder="请输入上覆土层松散程度权重" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="上覆土层松散程度 密实" v-bind="validateInfos.upperSoilLooseness1" id="SoilRockSlopeSettingForm-upperSoilLooseness1" name="upperSoilLooseness1">
								<a-input-number v-model:value="formData.upperSoilLooseness1" placeholder="请输入上覆土层松散程度 密实" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="上覆土层松散程度 松散" v-bind="validateInfos.upperSoilLooseness2" id="SoilRockSlopeSettingForm-upperSoilLooseness2" name="upperSoilLooseness2">
								<a-input-number v-model:value="formData.upperSoilLooseness2" placeholder="请输入上覆土层松散程度 松散" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="上覆土体类型权重" v-bind="validateInfos.upperSoilTypeWeight" id="SoilRockSlopeSettingForm-upperSoilTypeWeight" name="upperSoilTypeWeight">
								<a-input-number v-model:value="formData.upperSoilTypeWeight" placeholder="请输入上覆土体类型权重" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="上覆土体类型 粘性土" v-bind="validateInfos.upperSoilType1" id="SoilRockSlopeSettingForm-upperSoilType1" name="upperSoilType1">
								<a-input-number v-model:value="formData.upperSoilType1" placeholder="请输入上覆土体类型 粘性土" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="上覆土体类型 砂质土" v-bind="validateInfos.upperSoilType2" id="SoilRockSlopeSettingForm-upperSoilType2" name="upperSoilType2">
								<a-input-number v-model:value="formData.upperSoilType2" placeholder="请输入上覆土体类型 砂质土" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="上覆土体类型 碎石土" v-bind="validateInfos.upperSoilType3" id="SoilRockSlopeSettingForm-upperSoilType3" name="upperSoilType3">
								<a-input-number v-model:value="formData.upperSoilType3" placeholder="请输入上覆土体类型 碎石土" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="下部岩体特征权重" v-bind="validateInfos.underCharacteristicsWeight" id="SoilRockSlopeSettingForm-underCharacteristicsWeight" name="underCharacteristicsWeight">
								<a-input-number v-model:value="formData.underCharacteristicsWeight" placeholder="请输入下部岩体特征权重" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="下部岩体特征 无顺向结构面及软弱夹层" v-bind="validateInfos.underCharacteristics1" id="SoilRockSlopeSettingForm-underCharacteristics1" name="underCharacteristics1">
								<a-input-number v-model:value="formData.underCharacteristics1" placeholder="请输入下部岩体特征 无顺向结构面及软弱夹层" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="下部岩体特征 有顺向结构面及软弱夹层" v-bind="validateInfos.underCharacteristics2" id="SoilRockSlopeSettingForm-underCharacteristics2" name="underCharacteristics2">
								<a-input-number v-model:value="formData.underCharacteristics2" placeholder="请输入下部岩体特征 有顺向结构面及软弱夹层" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="下部岩体裂隙发育程度权重" v-bind="validateInfos.underRockFractureWeight" id="SoilRockSlopeSettingForm-underRockFractureWeight" name="underRockFractureWeight">
								<a-input-number v-model:value="formData.underRockFractureWeight" placeholder="请输入下部岩体裂隙发育程度权重" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="下部岩体裂隙发育程度 不发育" v-bind="validateInfos.underRockFracture1" id="SoilRockSlopeSettingForm-underRockFracture1" name="underRockFracture1">
								<a-input-number v-model:value="formData.underRockFracture1" placeholder="请输入下部岩体裂隙发育程度 不发育" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="下部岩体裂隙发育程度 发育" v-bind="validateInfos.underRockFracture2" id="SoilRockSlopeSettingForm-underRockFracture2" name="underRockFracture2">
								<a-input-number v-model:value="formData.underRockFracture2" placeholder="请输入下部岩体裂隙发育程度 发育" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型权重" v-bind="validateInfos.rockGroupTypeWeight" id="SoilRockSlopeSettingForm-rockGroupTypeWeight" name="rockGroupTypeWeight">
								<a-input-number v-model:value="formData.rockGroupTypeWeight" placeholder="请输入岩组类型权重" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 坚硬的块状侵入岩岩组(Y1)" v-bind="validateInfos.rockGroupType1" id="SoilRockSlopeSettingForm-rockGroupType1" name="rockGroupType1">
								<a-input-number v-model:value="formData.rockGroupType1" placeholder="请输入岩组类型 坚硬的块状侵入岩岩组(Y1)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 较坚硬、坚硬的块状火山熔岩，火山碎屑熔岩夹中厚—厚层状火山碎屑岩岩组(Y2)" v-bind="validateInfos.rockGroupType2" id="SoilRockSlopeSettingForm-rockGroupType2" name="rockGroupType2">
								<a-input-number v-model:value="formData.rockGroupType2" placeholder="请输入岩组类型 较坚硬、坚硬的块状火山熔岩，火山碎屑熔岩夹中厚—厚层状火山碎屑岩岩组(Y2)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 较坚硬、坚硬的薄-厚层状板岩、变碎屑岩、千枚岩岩组(B3)" v-bind="validateInfos.rockGroupType3" id="SoilRockSlopeSettingForm-rockGroupType3" name="rockGroupType3">
								<a-input-number v-model:value="formData.rockGroupType3" placeholder="请输入岩组类型 较坚硬、坚硬的薄-厚层状板岩、变碎屑岩、千枚岩岩组(B3)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 较坚硬、坚硬的片状片岩岩组(B2)" v-bind="validateInfos.rockGroupType4" id="SoilRockSlopeSettingForm-rockGroupType4" name="rockGroupType4">
								<a-input-number v-model:value="formData.rockGroupType4" placeholder="请输入岩组类型 较坚硬、坚硬的片状片岩岩组(B2)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 较坚硬、坚硬的块状变粒岩组(B1)" v-bind="validateInfos.rockGroupType5" id="SoilRockSlopeSettingForm-rockGroupType5" name="rockGroupType5">
								<a-input-number v-model:value="formData.rockGroupType5" placeholder="请输入岩组类型 较坚硬、坚硬的块状变粒岩组(B1)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 软硬相间的薄—厚层状含煤砂岩、页岩、泥岩岩组(S3)" v-bind="validateInfos.rockGroupType6" id="SoilRockSlopeSettingForm-rockGroupType6" name="rockGroupType6">
								<a-input-number v-model:value="formData.rockGroupType6" placeholder="请输入岩组类型 软硬相间的薄—厚层状含煤砂岩、页岩、泥岩岩组(S3)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 软弱的、较坚硬的薄—厚层状红层砂岩、砂砾岩、泥岩岩组(S4)" v-bind="validateInfos.rockGroupType7" id="SoilRockSlopeSettingForm-rockGroupType7" name="rockGroupType7">
								<a-input-number v-model:value="formData.rockGroupType7" placeholder="请输入岩组类型 软弱的、较坚硬的薄—厚层状红层砂岩、砂砾岩、泥岩岩组(S4)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 较坚硬、坚硬的薄—厚层状泥岩、页岩、硅质岩岩组(S1)" v-bind="validateInfos.rockGroupType8" id="SoilRockSlopeSettingForm-rockGroupType8" name="rockGroupType8">
								<a-input-number v-model:value="formData.rockGroupType8" placeholder="请输入岩组类型 较坚硬、坚硬的薄—厚层状泥岩、页岩、硅质岩岩组(S1)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 较坚硬、坚硬的中厚—厚层状砂岩、砂砾岩、页岩岩组(S2)" v-bind="validateInfos.rockGroupType9" id="SoilRockSlopeSettingForm-rockGroupType9" name="rockGroupType9">
								<a-input-number v-model:value="formData.rockGroupType9" placeholder="请输入岩组类型 较坚硬、坚硬的中厚—厚层状砂岩、砂砾岩、页岩岩组(S2)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 软弱的、较坚硬的薄层状页岩、砂岩、硅质岩岩组(S5) 赋값" v-bind="validateInfos.rockGroupType10" id="SoilRockSlopeSettingForm-rockGroupType10" name="rockGroupType10">
								<a-input-number v-model:value="formData.rockGroupType10" placeholder="请输入岩组类型 软弱的、较坚硬的薄层状页岩、砂岩、硅质岩岩组(S5) 赋값" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 较坚硬、坚硬的薄—厚层状弱岩溶化杂质灰岩、砂岩、页岩岩组(T3)" v-bind="validateInfos.rockGroupType11" id="SoilRockSlopeSettingForm-rockGroupType11" name="rockGroupType11">
								<a-input-number v-model:value="formData.rockGroupType11" placeholder="请输入岩组类型 较坚硬、坚硬的薄—厚层状弱岩溶化杂质灰岩、砂岩、页岩岩组(T3)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 较坚硬、坚硬的薄-厚层状中等岩溶化灰岩、白云质灰岩、页岩岩组(T2)" v-bind="validateInfos.rockGroupType12" id="SoilRockSlopeSettingForm-rockGroupType12" name="rockGroupType12">
								<a-input-number v-model:value="formData.rockGroupType12" placeholder="请输入岩组类型 较坚硬、坚硬的薄-厚层状中等岩溶化灰岩、白云质灰岩、页岩岩组(T2)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="岩组类型 坚硬的中厚-厚层状中等-强岩溶化灰岩、白云岩岩组(T1)" v-bind="validateInfos.rockGroupType13" id="SoilRockSlopeSettingForm-rockGroupType13" name="rockGroupType13">
								<a-input-number v-model:value="formData.rockGroupType13" placeholder="请输入岩组类型 坚硬的中厚-厚层状中等-强岩溶化灰岩、白云岩岩组(T1)" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="植被覆盖率权重" v-bind="validateInfos.vegetationCoverageWeight" id="SoilRockSlopeSettingForm-vegetationCoverageWeight" name="vegetationCoverageWeight">
								<a-input-number v-model:value="formData.vegetationCoverageWeight" placeholder="请输入植被覆盖率权重" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="植被覆盖率 b≤20°" v-bind="validateInfos.vegetationCoverage1" id="SoilRockSlopeSettingForm-vegetationCoverage1" name="vegetationCoverage1">
								<a-input-number v-model:value="formData.vegetationCoverage1" placeholder="请输入植被覆盖率 b≤20°" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="植被覆盖率 20°＜b≤80°" v-bind="validateInfos.vegetationCoverage2" id="SoilRockSlopeSettingForm-vegetationCoverage2" name="vegetationCoverage2">
								<a-input-number v-model:value="formData.vegetationCoverage2" placeholder="请输入植被覆盖率 20°＜b≤80°" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="植被覆盖率 ＞80°" v-bind="validateInfos.vegetationCoverage3" id="SoilRockSlopeSettingForm-vegetationCoverage3" name="vegetationCoverage3">
								<a-input-number v-model:value="formData.vegetationCoverage3" placeholder="请输入植被覆盖率 ＞80°" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="已有治理措施权重" v-bind="validateInfos.governanceMeasuresWeight" id="SoilRockSlopeSettingForm-governanceMeasuresWeight" name="governanceMeasuresWeight">
								<a-input-number v-model:value="formData.governanceMeasuresWeight" placeholder="请输入已有治理措施权重" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="已有治理措施 截排水沟" v-bind="validateInfos.governanceMeasures1" id="SoilRockSlopeSettingForm-governanceMeasures1" name="governanceMeasures1">
								<a-input-number v-model:value="formData.governanceMeasures1" placeholder="请输入已有治理措施 截排水沟" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="已有治理措施 护脚墙" v-bind="validateInfos.governanceMeasures2" id="SoilRockSlopeSettingForm-governanceMeasures2" name="governanceMeasures2">
								<a-input-number v-model:value="formData.governanceMeasures2" placeholder="请输入已有治理措施 护脚墙" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="已有治理措施 挡土墙" v-bind="validateInfos.governanceMeasures3" id="SoilRockSlopeSettingForm-governanceMeasures3" name="governanceMeasures3">
								<a-input-number v-model:value="formData.governanceMeasures3" placeholder="请输入已有治理措施 挡土墙" style="width: 100%" />
							</a-form-item>
						</a-col>
						<a-col :span="24">
							<a-form-item label="已有治理措施 综合治理" v-bind="validateInfos.governanceMeasures4" id="SoilRockSlopeSettingForm-governanceMeasures4" name="governanceMeasures4">
								<a-input-number v-model:value="formData.governanceMeasures4" placeholder="请输入已有治理措施 综合治理" style="width: 100%" />
							</a-form-item>
						</a-col>
          </a-row>
        </a-form>
      </template>
    </JFormContainer>
  </a-spin>
</template>

<script lang="ts" setup>
  import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
  import { defHttp } from '/@/utils/http/axios';
  import { useMessage } from '/@/hooks/web/useMessage';
  import { getValueType } from '/@/utils';
  import { saveOrUpdate } from '../SoilRockSlopeSetting.api';
  import { Form } from 'ant-design-vue';
  import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
  const props = defineProps({
    formDisabled: { type: Boolean, default: false },
    formData: { type: Object, default: () => ({})},
    formBpm: { type: Boolean, default: true }
  });
  const formRef = ref();
  const useForm = Form.useForm;
  const emit = defineEmits(['register', 'ok']);
  const formData = reactive<Record<string, any>>({
    id: '',
    cutSlopeHeightWeight: undefined,
    cutSlopeHeight1: undefined,
    cutSlopeHeight2: undefined,
    cutSlopeHeight3: undefined,
    cutSlopeHeight4: undefined,
    cutSlopeGradientWeight: undefined,
    cutSlopeGradient1: undefined,
    cutSlopeGradient2: undefined,
    cutSlopeGradient3: undefined,
    cutSlopeGradient4: undefined,
    cutSlopeShapeWeight: undefined,
    cutSlopeShape1: undefined,
    cutSlopeShape2: undefined,
    cutSlopeShape3: undefined,
    cutSlopeShape4: undefined,
    naturalSlopeGradientWeight: undefined,
    naturalSlopeGradient1: undefined,
    naturalSlopeGradient2: undefined,
    naturalSlopeGradient3: undefined,
    upperSoilLoosenessWeight: undefined,
    upperSoilLooseness1: undefined,
    upperSoilLooseness2: undefined,
    upperSoilTypeWeight: undefined,
    upperSoilType1: undefined,
    upperSoilType2: undefined,
    upperSoilType3: undefined,
    underCharacteristicsWeight: undefined,
    underCharacteristics1: undefined,
    underCharacteristics2: undefined,
    underRockFractureWeight: undefined,
    underRockFracture1: undefined,
    underRockFracture2: undefined,
    rockGroupTypeWeight: undefined,
    rockGroupType1: undefined,
    rockGroupType2: undefined,
    rockGroupType3: undefined,
    rockGroupType4: undefined,
    rockGroupType5: undefined,
    rockGroupType6: undefined,
    rockGroupType7: undefined,
    rockGroupType8: undefined,
    rockGroupType9: undefined,
    rockGroupType10: undefined,
    rockGroupType11: undefined,
    rockGroupType12: undefined,
    rockGroupType13: undefined,
    vegetationCoverageWeight: undefined,
    vegetationCoverage1: undefined,
    vegetationCoverage2: undefined,
    vegetationCoverage3: undefined,
    governanceMeasuresWeight: undefined,
    governanceMeasures1: undefined,
    governanceMeasures2: undefined,
    governanceMeasures3: undefined,
    governanceMeasures4: undefined,
  });
  const { createMessage } = useMessage();
  const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
  const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
  const confirmLoading = ref<boolean>(false);
  //表单验证
  const validatorRules = reactive({
  });
  const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });

  // 表单禁用
  const disabled = computed(()=>{
    if(props.formBpm === true){
      if(props.formData.disabled === false){
        return false;
      }else{
        return true;
      }
    }
    return props.formDisabled;
  });

  
  /**
   * 新增
   */
  function add() {
    edit({});
  }

  /**
   * 编辑
   */
  function edit(record) {
    nextTick(() => {
      resetFields();
      const tmpData = {};
      Object.keys(formData).forEach((key) => {
        if(record.hasOwnProperty(key)){
          tmpData[key] = record[key]
        }
      })
      //赋值
      Object.assign(formData, tmpData);
    });
  }

  /**
   * 提交数据
   */
  async function submitForm() {
    try {
      // 触发表单验证
      await validate();
    } catch ({ errorFields }) {
      if (errorFields) {
        const firstField = errorFields[0];
        if (firstField) {
          formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
        }
      }
      return Promise.reject(errorFields);
    }
    confirmLoading.value = true;
    const isUpdate = ref<boolean>(false);
    //时间格式化
    let model = formData;
    if (model.id) {
      isUpdate.value = true;
    }
    //循环数据
    for (let data in model) {
      //如果该数据是数组并且是字符串类型
      if (model[data] instanceof Array) {
        let valueType = getValueType(formRef.value.getProps, data);
        //如果是字符串类型的需要变成以逗号分割的字符串
        if (valueType === 'string') {
          model[data] = model[data].join(',');
        }
      }
    }
    await saveOrUpdate(model, isUpdate.value)
      .then((res) => {
        if (res.success) {
          createMessage.success(res.message);
          emit('ok');
        } else {
          createMessage.warning(res.message);
        }
      })
      .finally(() => {
        confirmLoading.value = false;
      });
  }


  defineExpose({
    add,
    edit,
    submitForm,
  });
</script>

<style lang="less" scoped>
  .antd-modal-form {
    padding: 14px;
  }
</style>
